cmake_minimum_required(VERSION 3.16)
project(galang_vm)

set(CMAKE_C_COMPILER g++)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")

include_directories(include)
include_directories(../third_party)

add_library(railgun SHARED
    src/object/hiInteger.cpp
    src/object/hiDouble.cpp
    src/object/hiString.cpp
    src/object/hiObject.cpp
    src/object/hiList.cpp
    src/object/hiDict.cpp
    src/object/klass.cpp
    src/util/arrayList.cpp
    src/util/map.cpp
    src/util/handles.cpp
    src/runtime/interpreter.cpp
    src/runtime/universe.cpp
    src/runtime/frameObject.cpp
    src/runtime/functionObject.cpp
    src/runtime/stringTable.cpp
    src/runtime/module.cpp
    src/runtime/traceback.cpp
    src/runtime/generator.cpp
    src/runtime/cellObject.cpp
    src/memory/heap.cpp
    src/memory/oopClosure.cpp
    src/code/binaryFileParser.cpp
    src/code/codeObject.cpp
)

add_executable(galang src/galvm.cpp)
target_link_libraries(railgun PUBLIC dl)
target_link_libraries(galang PUBLIC railgun)

ADD_LIBRARY(math SHARED
    src/extlib/math.cpp
)

target_link_libraries(math PUBLIC railgun)

# test
add_executable(test_vm 
    test/test_main.cpp
)
target_link_libraries(test_vm)
